﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace VoxelConverter
{
    public static class ExtensionMethods
    {
        public static T[] SubArray<T>(this T[] data, int index, int length)
        {
            if (data.Length > 0 && index < data.Length && length + index <= data.Length && length > 0 && index >= 0)
            {
                T[] result = new T[length];
                Array.Copy(data, index, result, 0, length);
                return result;
            }

            return null;
        }
    }
}
